﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudentCenter.aspx.cs"
    Inherits="ExaminationSys.StudentCenter" MasterPageFile="~/View/Share/Index.Master" %>
<%@ Import Namespace="ExaminationSys.DataAccess.Entity" %>

<asp:Content ID="head" ContentPlaceHolderID="head" runat="server">
    <link type="text/css" rel="stylesheet" media="all" href="css/others.css" />

    <script src="js/jquery.js" type="text/javascript"></script>

   <script type="text/javascript">
       $(function () {
           $("#btnSignOut").click(function () {
               var answer = confirm("是否退出?");
               if (answer) {

                   $.ajax({
                       type: "GET",
                       cache: false,
                       contentType: "application/json",
                       url: "ashx/StudentSignOutHandler.ashx",
                       dataType: 'json',
                       data: null,
                       async: false,
                       success: function (data) {
                           if (data != '200') {
                               alert('操作失败'); return false;
                           }
                           else {
                               var host = window.location.host;
                               window.location.href = "http://" + host + "/Index.aspx";
                           }
                       }
                   });
               }
           });
       });
</script>
</asp:Content>
<asp:Content ID="headerContent" ContentPlaceHolderID="HeaderHolder" runat="server">
    <div class="h-top">
        <div class="logo fl">
            <img src="images/logo.gif" alt="上海交通大学英语学习中心" /></div>
        <div class="navandsearch fr">
            <ul class="nav">
                  <li><a class="nav-home" href="Index.aspx" title="首页">首页</a></li>
                <li><a class="nav-info" href="Newslist.aspx" title="信息快递">信息快递</a></li>
                <li><a class="nav-help" href="Help.aspx" title="帮助">帮助</a></li>
            </ul>
            <div class="h-search">
                <input id="textKey" class="text" name="" type="text" value="搜索信息" />
                <input id="btnSearch" class="publicbtn btn-search" name="" type="button" value="搜索" />
            </div>
        </div>
        <!--end navandsearch-->
    </div>
    <div class="h-banner">
        <img src="images/pic/pic02.jpg" width="966" height="308" /></div>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHolder" runat="server">


    <div class="side">
        <div class="box203">
            <div class="titles">
                <img src="images/tit_xx.gif" alt="用户信息" /></div>
            <div class="conts side-login-on">
                <p class="tit">
                    <span class="red">欢迎您！</span><span><%=  LoginName %></span>同学</p>
                <ul>
                    <li><a href="Profile.aspx">个人资料</a></li>
                    <li><a href="ChangePassword.aspx">密码修改</a></li>
                </ul>
                <div class="button">
                    <a href="StudyCenter.aspx" id="btnStudycenter"><span style="border:1px solid #e3e3e3;color:red;padding:3px;margin:18px">学习中心</span></a>
                    <input class="publicbtn btn-logout" id="btnSignOut" name="" type="button" value="退出" /></div>
            </div>
            <div class="box-bbg">
            </div>
        </div>
        <div class="side-mod-menu">
            <h2>
                <span class="subtit">当前阶段(<%=LevelName%>)</span></h2>


                <%
                    
                    foreach (var subSectionInfo in SubSectionInfoCollection)
                    {
                        htmlStr.AppendFormat("<h3><span>{0}</span></h3>", subSectionInfo.Name);
                        htmlStr.Append("<ul>");

                        var subDetailCollection = GetListBySubSectionId(subSectionInfo.ID);



                        foreach (var detailInfo in subDetailCollection)
                        {

                            if (detailInfo.KnowledgeType == (int)EnumEnumSubSectionType.测试 || detailInfo.KnowledgeType == (int)EnumEnumSubSectionType.练习)
                            {
                                var href = string.Format("View/Student/JoinExamination.aspx?paperid={0}&stype={1}", detailInfo.PaperID,detailInfo.KnowledgeType);
                                htmlStr.AppendFormat("<li><a target=\"_blank\" href=\"{0}\">{1}</a></li>", href, detailInfo.Name);
                            }
                            else
                            {
                                var href = string.Format("/LearningDetail.aspx?level={0}&id={1}&sid={2}", KnowlegdeLevel,
                                                         detailInfo.ID, SectionId);
                                htmlStr.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", href, detailInfo.Name);
                            }
                        }
                        htmlStr.Append("</ul>");

                    }%>
                    
                
                <%= htmlStr.ToString() %>

          <%--  <h3>
                <span>知识点学习</span></h3>
            <ul>
                <li><a href="#">单元1</a></li>
                <li><a href="#">单元2</a></li>
                <li><a href="#">单元3</a></li>
            </ul>
            <h3>
                <span>练习</span></h3>
            <ul>
                <li><a href="#">练习1</a></li>
                <li><a href="#">练习2</a></li>
                <li><a href="#">练习3</a></li>
            </ul>
            <h3>
                <span>测试</span></h3>
            <ul>
                <li><a href="#">测试1</a></li>
                <li><a href="#">测试2</a></li>
                <li><a href="#">测试3</a></li>
            </ul>--%>
        </div>
    </div>
    <!--end side-->
    <div class="contents">
        <div class="other-titles">
            <span class="subtit"><%= SectionInfo!=null?SectionInfo.Name:""%></span></div>



            <% if(SectionInfo!=null)
               {
                   var sectionPapers = GetSectionPaperBySectionId(SectionInfo.ID);

                   if (sectionPapers != null && sectionPapers.Count > 0)
                   {
                       int pos = 0;
                       bool existsHistory = false;
                       foreach (var sectionPaper in sectionPapers)
                       {
                           pos += 1;
                           htmlStrSectionInfo.Append(pos == 1
                                                         ? "<dl class=\"study-cent study-cent-fist loginmod-main\">"
                                                         : "<dl class=\"study-cent  loginmod-main\">");

                           htmlStrSectionInfo.Append(" <dt><span class=\"pic\">");
                           //htmlStrSectionInfo.AppendFormat(
                           //  "<img src=\"{0}\" alt=\"{1}\" /></span> <span class=\"subtit\">{1}</span>",
                           //  string.IsNullOrEmpty(SectionInfo.Img) ? "images/defaultSection.png" : SectionInfo.Img,
                           //  sectionPaper.TestType == (int)EnumTestType.水平测试 ? "水平测试" : "动机测试");
                           if (sectionPaper.TestType == (int) EnumTestType.动机测试)
                           {
                               htmlStrSectionInfo.Append(
                                   "<img src=\"images/x-04.gif\" alt=\"动机测试\" /></span> <span class=\"subtit\">动机测试</span>");
                           }
                           else if (sectionPaper.TestType == (int) EnumTestType.水平测试)
                           {
                               htmlStrSectionInfo.Append(
                                   "<img src=\"images/x-05.gif\" alt=\"水平测试\" /></span> <span class=\"subtit\">水平测试</span>");
                           }
                           htmlStrSectionInfo.Append(" </dt>");
                           
                           
                           //dd tag begin
                           htmlStrSectionInfo.Append("<dd>");

                           htmlStrSectionInfo.Append(" <h3>评语与建议</h3>");
                           //htmlStrSectionInfo.Append(" <p>您还没有登录过该栏目您还没有登录过该栏目</p>");

                           var item = GetStudentPaper(sectionPaper.PaperID);
                           if(item==null)
                           {
                               htmlStrSectionInfo.Append(" <p>您还没有登录过该栏目您还没有登录过该栏目</p>");
                               htmlStrSectionInfo.AppendFormat(
                                   "<div class=\"button\"><a href=\"View/Student/JoinExamination.aspx?paperid={0}&sid={1}&stype=2\"><img src=\"images/btn-cs-start.gif\" alt=\"开始测试\" /></a></div>",
                                   sectionPaper.PaperID, SectionInfo.ID);

                           }
                           else
                           {
                               PaperFeedback feedback = GetStudentTestComment(sectionPaper.PaperID);
                               if (feedback != null)
                               {
                                   htmlStrSectionInfo.Append(string.Format(" <p>{0}</p>",feedback.Comment));
                               }
                               htmlStrSectionInfo.AppendFormat(
                                   "<div class=\"button\"><a href=\"View/Student/JoinExamination.aspx?paperid={0}&sid={1}&retest=1&stype=2\"><img src=\"images/btn-cs-r.gif\" alt=\"重新测试\" /></a></div>", sectionPaper.PaperID, SectionInfo.ID);
                           }

                           
                           htmlStrSectionInfo.Append("</dd>");
                           //end dd tag

                           htmlStrSectionInfo.Append("</dl>");
                       }
                   }
                  

           } %>
              <%=htmlStrSectionInfo.ToString()%>
        <%--<dl class="study-cent study-cent-fist loginmod-main">

       

            <dt><span class="pic">
                <img src="images/x-04.gif" alt="动机测试" /></span> <span class="subtit">动机测试</span>
            </dt>
            <dd>
                <h3>
                    评语与建议</h3>
                <p>
                    您还没有登录过该栏目您还没有登录过该栏目</p>
                <p>
                    您还没有登录过该栏目您还没有登录过该栏目</p>
                <p>
                    您还没有登录过该栏目您还没有登录过该栏目</p>
                <div class="button">
                    <a href="#">
                        <img src="images/btn-cs.gif" alt="测试历史" /></a></div>
            </dd>
        </dl>
        <dl class="study-cent  loginmod-main">
            <dt><span class="pic">
                <img src="images/x-05.gif" alt="水平测试" /></span> <span class="subtit">水平测试</span>
            </dt>
            <dd>
                <h3>
                    评语与建议</h3>
                <p>
                    您还没有登录过该栏目您还没有登录过该栏目</p>
                <p>
                    您还没有登录过该栏目您还没有登录过该栏目</p>
                <p>
                    您还没有登录过该栏目您还没有登录过该栏目</p>
                <div class="button">
                    <a href="#">
                        <img src="images/btn-cs.gif" alt="测试历史" /></a></div>
            </dd>
        </dl>--%>
    </div>
    <!--end contents-->
</asp:Content>
